<?php /*
@session_start();
 if((!isset($_SESSION["kt_login_id"]) && !isset($_SESSION["kt_login_user"]) &&  !isset($_SESSION["kt_login_level"])) ) {

    header("Location: login.php");
    exit;
	
}else{

$level = addslashes($_SESSION['kt_login_user']);
$user = addslashes($_SESSION['kt_login_level']);

echo $level;
echo $user;
}*/

require_once("classes/newsletter.class.php");

//Instanciando Objetos

$newsletter 	= new Newsletter();
//Invocando metodo
$listNewsletter	= $newsletter->listObject(); 

//criando array local
while($row = mysql_fetch_assoc($listNewsletter)){
  $arr[] = $row; }
$i = 1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/user.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Print Controller</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEditableHeadTag -->
<!-- InstanceEndEditable -->
<style type="text/css" media="all">
<!--
@import url("css/basics.css");
-->
</style>
<!-- TinyMCE -->
<script type="text/javascript" src="includes/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
mode : "textareas",
		theme : "advanced",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
	});
</script>
<!-- /TinyMCE -->
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
</head>


<body>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
    <td width="79%" rowspan="2"><img src="images/logo.png" width="293" height="112" /></td>
    <td width="21%"><p>Version: 1.0</p>
    <p>Status: Beta</p></td>
  </tr>
  <tr>
    <td><!-- InstanceBeginEditable name="logout" -->logout<!-- InstanceEndEditable --> </td>
  </tr>
  <tr>
    <td colspan="2" background="images/bg.png" style="padding-left:10px;"><table width="59%" border="0" cellspacing="1" cellpadding="1">
    <?php
		//if ($level == 0){
	?>
        <tr>
          <td height='35'><a href='index.php'>Home</a></td>
         <!-- <td><a href='../suprimentos.php' target='_parent'>Suprimentos</a></td>-->
        </tr>
    <?php
   // }else
	//	{ 
	//	if ($level == 1){
	?>
        <tr>
          <td height='35'><a href='index.php'>Home</a></td>
          <td><a href='ListaRegistrados.php' target='_parent'>Registed</a></td>
          <td><a href="newsletterList.php" target='_parent'>Newsletter</a></td>
          <td><a href="directMailList.php" target='_parent'>Direct Mail</a></td>

        </tr>
    <?php
 //   }
	
//	}
	
	?>
	
	
    
    </table></td>
  </tr>
  <tr>
    <td colspan="2"><!-- InstanceBeginEditable name="content" -->  <div class="KT_tng" >
      <h1> Qls_respondents</h1>
      <div class="msgerror" id="msgerror">
      <?php ?>
      </div>
	  <?php 
	  
	  $count = count($arr);
   	if($count > 0){
       reset($arr);
       $num = count(current($arr));
       echo "<table 'listTable'> ";
       echo "<tr>\n";
	    //print_r ($arr);
       foreach(current($arr) as $key => $value){
	   // print_r ($arr);
           echo "<th>";
           echo $key."&nbsp;";
           echo "</th>\n";   
         }   
       echo "</tr>\n";
       while ($curr_row = current($arr)) {
          // print_r ($curr_row); 
		   		  //pintando tabela
		  if (($i % 2) == 1){ 
		   	$fundo="#FEFEFE"; 
		  }else{ 
		  	$fundo="#CDCDCD"; 
		  }
			$i++;
			echo "<tr bgcolor=$fundo>\n";
           $col = 1;
          // print_r($curr_row);
		   
		   while ($curr_field = current($curr_row)) {
		  //print_r ($curr_field);
		  
               echo "<td>";
               echo $curr_field."&nbsp;";
               echo "</td>\n";
			   
               next($curr_row);
               $col++;
               }
			   echo "<td><a href='newslatterpage.php?newsletter=".$curr_row['ID']."' target='_blank'>Preview</a></td>\n";
           while($col <= $num){
               echo "<td>&nbsp;</td>\n";
               $col++;       
           }
		  // echo "<td><a href='".$curr_field."' target='_blank'>Preview</a></td>\n";
           echo "</tr>\n";
           next($arr);
       	}
       echo "</table>\n";
     }else{
	 	echo "No Results";
	 }
   
	  
	  
	  
	  
	  
	  
	  
	  
	  /*
	  // Formatando Tabela de Resultados
  	  echo"<table class = 'listTable' >
	  		<tr>";
		foreach($arrCampo as $campo){
			echo "<th>".$campo."</th>";
		}
		//$arrValores = array_values($lists);
	echo "<th colspan= '3'>:: FUNCTIONS ::</th>
	</tr>";
	  // while($lists =mysql_fetch_assoc($listNewsletter) ){
	   foreach($list as $key=>$valor){
	   	
	 
	   print_r($lists);
	   echo "<br>";
	   
		  //pintando tabela
		  if (($i % 2) == 1){ 
		   	$fundo="#FEFEFE"; 
		  }else{ 
		  	$fundo="#CDCDCD"; 
		  }
			$i++;
			echo "<tr bgcolor=$fundo>";
			//$arrValores = array_values($lists);
			foreach($valor as $valorR){
				echo "<td>".$valorR."</td>";
			}
		echo "<td>";
		print_r($lists );
		echo"</td><td>View</td><td>View</td>
		</tr>";
		}
	echo "</table>";
   */?>
      </div><!-- InstanceEndEditable --></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
</table>

</body>
<!-- InstanceEnd --></html>
